(deftemplate Meteo
    (slot zi)
    (slot perioada-zilei);seara dimineata inainte miezul noptii 15 ore inainte sau 24
    (slot cer) ;cer rosu - a doua zi senin, fara precipitatii dar ger
    (slot ceata); ceata sera a sau dimi- a doua zi cald
    (slot nori);cumulus=vreme buna, cumulus-> nimbostratus(vant NE-S); cirrocumulus+NE-s=ploaie; 
    ;stratocumulus->cumulonimbus(vant NE-S);cumulonimbus-caderi zapada daca se vad inainte miez n
    ;cirrostratus-ploaie inainte 15 ore daca vant NE-S; altostratus-ploaie cu 24 ore inainte daca vant NE-S 
    ;altocumulus-ploaie cu 15 ore inainte, vant NE-S
    (slot vant);NE-S
    )
(assert (Meteo(zi Luni)(perioada-zilei seara)(cer rosu)(ceata nu)(nori nu)(vant nu)))
(assert (Meteo(zi Miercuri)(perioada-zilei seara)(cer nu)(ceata da)(nori nu)(vant nu)))
(assert (Meteo(zi Vineri)(perioada-zilei seara)(cer nu)(ceata nu)(nori cirrocumulus)(vant NE-S)))
(assert (Meteo(zi Joi)(perioada-zilei imn)(cer nu)(ceata nu)(nori cumulonimbus)(vant nu)))
(assert (Meteo(zi Duminica)(perioada-zilei seara)(cer nu)(ceata nu)(nori altostratus)(vant nu)))

(facts)
(run)

(printout t "--------------------------------------------" crlf)
(defrule r1
   (Meteo (zi ?n)(perioada-zilei ?pz)(cer ?c ))
        (test (and(eq ?pz seara)(eq ?c rosu)))
 
=>
(printout t  ?n " va fi senin, dar ger conform ANM! " crlf)
)

(run)
(printout t "--------------------------------------------" crlf)
(defrule r2
   (Meteo (zi ?n)(perioada-zilei ?pz)(ceata ?ct ))
        (test (and(eq ?pz seara)(eq ?ct da)))
 
=>
(printout t  ?n " va fi cald conform ANM! " crlf)
)

(run)
(printout t "--------------------------------------------" crlf)
(defrule r3
   (Meteo (zi ?n)(perioada-zilei ?pz)(nori ?no )(vant ?v))
        (test (and(eq ?no cirrocumulus)(eq ?v NE-S)))
 
=>
(printout t  ?n " va ploua conform ANM! " crlf)
)

(run)

(printout t "--------------------------------------------" crlf)
(defrule r4
   (Meteo (zi ?n)(perioada-zilei ?pz)(nori ?no ))
        (test (and(eq ?pz imn)(eq ?no cumulonimbus)))
 
=>
(printout t  ?n " va ninge conform ANM! " crlf)
)

(run)
(printout t "--------------------------------------------" crlf)
(defrule r5
   (Meteo (zi ?n)(perioada-zilei ?pz)(nori ?no )(vant ?v))
        (test (and(eq ?pz seara)(eq ?no altostratus) (eq ?v nu)))
 
=>
(printout t  ?n " va ploua doar daca va bate vantul din NE spre S conform ANM! " crlf)
)

(run)